<!DOCTYPE html>
<html>
	<head>
<meta charset="UTF-8">
<meta id="viewport" name="viewport" content="width=device-width;initial-scale=1.0;maximum-scale=1;user-scalable=no">
<meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport" />
<title>我的专属海报</title>
<link rel="stylesheet" href="/static/home/css/style.css" />
<link rel="stylesheet" href="/static/home/css/ydui.css">
<script src="/static/home/js/ydui.flexible.js"></script>
<script src="/static/home/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="/static/home/js/mui.min.js"></script>
<script type="text/javascript"> 
document.addEventListener( "plusready", onPlusReady, false );
// 扩展API加载完毕，现在可以正常调用扩展API 
function onPlusReady() { 
	mui.init({
	    gestureConfig:{
	        tap: true, //默认为true
	        doubletap: true, //默认为false
	        longtap: true, //默认为false
	        swipe: true, //默认为true
	        drag: true, //默认为true
	        hold:true,//默认为false，不监听
	        release:false//默认为false，不监听
	    }
	});
	document.getElementById("source_img").addEventListener('longtap',function(){
	    var imgurl = this.src;
	    var imgDtask = plus.downloader.createDownload(imgurl,{method:'GET'}, function (d,status) {
	            if(status == 200){
	                plus.gallery.save(d.filename, function(){
	                    plus.io.resolveLocalFileSystemURL(d.filename, function(res){
	                        mui('#picture').popover('toggle');
	                        mui.toast('保存成功');
	                    });

	                })
	            }else{
	                mui.toast('保存失败')
	            }
	      });
	    imgDtask.start();
	});
} 
</script>
	</head>
	<body style="background-color: #fff">
		<div class="mesplaybill-box">
			<div class="msbl-img-box">
				<img id="source_img" src="/uploads/loan/{$vid}{$id}.qrcode.png" alt="" />
			</div>
			<div class="msbl-btm-box">
				<p class="msbl-tl">我的专属海报</p>
				<div class="msbl-sms-box">
					<span>1、长按海报保存图片，分享海报给好友</span>
					<span>2、您可点击复制链接按钮，发送给好友</span>
				</div>
				<button class="btn-copys" id="copy">复制链接</button>
			</div>
		</div>
		<script src="/static/home/js/ydui.js"></script>
		<script src="/static/home/js/clipboard.min.js"></script>
		<script>
			$("#copy").click(function() {
				YDUI.dialog.toast('复制成功', 'success', 1000);
				var clipboard = new Clipboard('.btn-copys', {
					text: function() {
						return '{$url}';
					}
				});
			})
		</script>
	</body>
</html>